#ifndef __TIMER_H__
#define __TIMER_H__

#include "system.h"

#define TIMER_FREQ 1000
#define PIT_CHAN0 0x40
#define PIT_CHAN1 0x41
#define PIT_CHAN2 0x42
#define PIT_COMMAND 0x43

struct timed_func {
	unsigned int last_call;
	unsigned int interval;
	void (*func) (void);
};

extern unsigned int timer_ticks;

void timer_handler(struct regs *r);
void timer_install();
int uptime();
void reg_timed_func(int interval, void (*func) (void));

#endif
